# makefile for workout program

EXE=workoutProgram

CC = g++
#CFLAGS = -DDEBUG -DCOMMANDLINE -Wall -Werror
CFLAGS = -DDEBUG -DCOMMANDLINE -Wall
LFLAGS = -Wl,-rpath,.
SRC = ./
BIN = ./bin
PUBLISHDIR = /Volumes/mkrugman/Sites
LIBS = 
OBJ = $(EXE)_Data

#########################################################################################

.PHONY : all
all : app
	echo "creating command line based workouts"
	cp lifting.css $(BIN)/
	cp ical.png $(BIN)/
	echo "Generating a workout"
	#cd bin; ./$(EXE) -f EricRunning -d 20100531 -w 15 -t RunningFIRST -Running 18 -BodyWeight 160
	#cd bin; ./$(EXE) -f JulieRunning -d 20100531 -w 15 -t RunningFIRST -Running 18 -BodyWeight 100
	#cd bin; ./$(EXE) -f Justin -d 20100601 -w 15 -t RunningFIRST -Running 18 -BodyWeight 160
	#cd bin; ./$(EXE) -f MattRunning -d 20100531 -w 15 -t RunningFIRST -Running 18 -BodyWeight 160
	#cd bin; ./$(EXE) -f Matt -d 20100525 -w 12 -t OlympicLifting -CleanAndJerk 220 -Snatch 175 -BackSquat 315 -FrontSquat 265 -Press 145 -Deadlift 365
	#cd bin; ./$(EXE) -f Rob -d 20100525 -w 12 -t OlympicLifting -CleanAndJerk 230 -Snatch 175 -BackSquat 255 -FrontSquat 245 -Press 130 -Deadlift 315
	#cd bin; ./$(EXE) -f Phil -d 20100525 -w 12 -t OlympicLifting -CleanAndJerk 170 -Snatch 140 -BackSquat 215 -FrontSquat 205 -Press 110 -Deadlift 275
	#cd bin; ./$(EXE) -f MattTemp -d 20100517 -w 12 -t OlympicMaintenance -CleanAndJerk 220 -Snatch 175 -BackSquat 315 -FrontSquat 265 -Press 145 -Deadlift 365
	#cd bin; ./$(EXE) -f MattClimbing -d 20100517 -w 12 -t ClimbingTraining -CleanAndJerk 220 -Snatch 175 -BackSquat 315 -FrontSquat 265 -Press 145 -Deadlift 365
	#cd bin; ./$(EXE) -f Jeremiah -d 20101102 -w 12 -t OlympicExtended -CleanAndJerk 165 -Snatch 130 -BackSquat 205 -FrontSquat 190 -Press 100 -Deadlift 225
	#cd bin; ./$(EXE) -f Jeremiah -d 20101102 -w 12 -t OlympicExtended -CleanAndJerk 165 -Snatch 130 -BackSquat 205 -FrontSquat 190 -Press 100 -Deadlift 225
	#cd $(BIN); ./$(EXE) -f JeremiahContest900 -d 20101228 -w 4 -t Contest900 -CleanAndJerk 176 -Snatch 125 -BackSquat 275 -FrontSquat 240
	#cd $(BIN); ./$(EXE) -f MattContest900 -d 20101228 -w 4 -t Contest900 -CleanAndJerk 230 -Snatch 180 -BackSquat 320 -FrontSquat 275
	cd bin; ./$(EXE) -f Phil -d 20110301 -w 4 -t OlympicTraining -CleanAndJerk 170 -Snatch 140 -BackSquat 215 -FrontSquat 205 -Press 110 -Deadlift 275
	cd bin; ./$(EXE) -f Matt -d 20110301 -w 4 -t OlympicTraining -CleanAndJerk 230 -Snatch 180 -BackSquat 320 -FrontSquat 270 -Press 145 -Deadlift 365
	cd bin; ./$(EXE) -f Jeremiah -d 20110301 -w 4 -t OlympicTraining -CleanAndJerk 176 -Snatch 125 -BackSquat 275 -FrontSquat 240

#########################################################################################

.PHONY : app
app : $(OBJ) $(BIN) $(BIN)/$(EXE)

$(BIN) : 
	mkdir $(BIN)

$(OBJ) : 
	mkdir $(OBJ)

$(BIN)/$(EXE) : $(OBJ)/Exercise.o $(OBJ)/WorkoutPrograms.o $(OBJ)/Workout.o $(OBJ)/Time_ISO8601.o $(OBJ)/CoreWorkouts.o $(OBJ)/OlympicWorkouts.o
	$(CC) -g $(CFLAGS) $(LFLAGS) $^ $(LIBS) -o $@

$(OBJ)/WorkoutPrograms.o : WorkoutPrograms.cpp
	$(CC) -c $(CFLAGS) $< -o $@

$(OBJ)/Exercise.o : Exercise.cpp
	$(CC) -c $(CFLAGS) $< -o $@

$(OBJ)/Workout.o : Workout.cpp
	$(CC) -c $(CFLAGS) $< -o $@

$(OBJ)/CoreWorkouts.o : CoreWorkouts.cpp
	$(CC) -c $(CFLAGS) $< -o $@
	
$(OBJ)/OlympicWorkouts.o : OlympicWorkouts.cpp
	$(CC) -c $(CFLAGS) $< -o $@	

$(OBJ)/Time_ISO8601.o : Time_ISO8601.cpp
	$(CC) -c $(CFLAGS) $< -o $@

.PHONY : clean
clean :
	rm -rf $(OBJ)
	rm -rf $(BIN)
	rm -vf *.html
	rm -vf *.ics
	
.PHONY : publish
publish : app
	echo "Publishing new files"
	cp lifting.css $(PUBLISHDIR)/
	cp ical.png $(PUBLISHDIR)/
	cp $(BIN)/* $(PUBLISHDIR)
	





